<template>
  <div class="app-container">
    <el-form ref="form" :model="form" label-width="80px" class="active-form">
      <el-form-item label="用户名">
        <el-input v-model="form.username"  placeholder="请输入内容"></el-input>
      </el-form-item>
     <el-form-item label="手机号">
        <el-input v-model="form.phone"  placeholder="请输入内容"></el-input>
      </el-form-item>    
     <el-form-item label="天数">
        <el-input v-model="form.days"  placeholder="请输入内容"></el-input>
      </el-form-item>   			 
      <el-form-item>
        <el-button type="primary" @click="onSubmitPre">生成预激活码</el-button>
      </el-form-item>
			     <el-form-item label="预激活码">
        <el-input type="textarea" v-model="form.preActiveCode"  placeholder="请输入预激活码"></el-input>
      </el-form-item>  
			<el-divider>激活</el-divider>

			<el-form-item label="激活码">
        <el-input type="textarea" v-model="form.activeCode"  placeholder="请输入激活码"></el-input>
      </el-form-item>  
			<el-form-item>
        <el-button type="info" @click="onSubmit">取消</el-button>
				<el-button type="primary" @click="onSubmit">激活</el-button>
      </el-form-item>  			   
    </el-form>
  </div>
</template>

<script>
const logger  = require('@/utils/electron/index').Logger('aboutVersion')
import { encruption, decrypt } from '@/utils/jsencrypt'

export default {
	name: "Action",
  data() {
    return {
      form: {
        username:'花无缺',
        phone: "1",
        days: 30,
				preActiveCode: '',
				activeCode: ''
      }
    }
  },
  methods: {
    onSubmitPre() {
      logger.info('[onSubmit保存配置信息]:',this.form)
      let codeEnc = encruption(JSON.stringify(this.form))
      logger.info('加密后的数据',codeEnc)
    },
    onSubmit() {
      logger.info('[onSubmit保存配置信息]:',this.form)
      let codeEnc = encruption(JSON.stringify(this.form))
      logger.info('加密后的数据',codeEnc)
    }
  }
}
</script>

<style scoped>
	.el-input {
			width: 300px;
		}
  .active-form {
    	width: 600px;
	
  }
</style>

